package com.geek.factory.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.geek.factory.dto.DeviceRepairRecordDTO;
import com.geek.factory.entity.DeviceRepairRecord;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DeviceRepairRecordMapper  extends BaseMapper<DeviceRepairRecord> {

    @Select("SELECT r.*, " +
            "       d.device_name AS deviceName, " +
            "       d.device_type AS deviceType, " +
            "       pl.line_name AS lineName " +
            "FROM device_repair_record r " +
            "LEFT JOIN device_repair_report d ON r.report_id = d.id " +
            "LEFT JOIN product_line pl ON d.product_line_id = pl.id " +
            "ORDER BY r.repair_time DESC")
    List<DeviceRepairRecordDTO> selectWithDetails();

}
